﻿using System;
using System.ComponentModel;
using System.Windows.Media;
using System.Windows.Media.Imaging;

namespace JDKD.BMCS.Business
{
        public class Group : INotifyPropertyChanged
        {
                public Group(int id)
                {
                        Id = id;
                }

                public static ImageSource RedImageSource = new BitmapImage(new Uri("pack://application:,,,/Images/RedCircle.png"));

                public static ImageSource GreenImageSource = new BitmapImage(new Uri("pack://application:,,,/Images/GreenCircle.png"));

                public int Id { get; private set; }

                private bool isPushing;

                public bool IsPushing
                {
                        get
                        {
                                return isPushing;
                        }
                        set
                        {
                                isPushing = value;

                                OnPropertyChanged("PushImageSource");
                        }
                }

                public ImageSource PushImageSource
                {
                        get
                        {
                                if (IsPushing)
                                {
                                        return Channel.GreenImageSource;
                                }
                                else
                                {
                                        return Group.RedImageSource;
                                }
                        }
                }

                #region 事件

                public event PropertyChangedEventHandler PropertyChanged;

                #endregion 事件

                #region 方法

                public void OnPropertyChanged(string propertyName)
                {
                        if (PropertyChanged != null)
                        {
                                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
                        }
                }

                #endregion 方法
        }
}